# -*- makefile -*-
# Makefile for Microsoft Windows with Borland C++ Builder 5.2 compiler

.SUFFIXES: .bin .obj .c .cpp

LIBSOU = class.cpp compiler.cpp database.cpp hashtab.cpp file.cpp \
	sync.cpp symtab.cpp ttree.cpp cursor.cpp query.cpp server.cpp w32sock.cpp \
	wwwapi.cpp cli.cpp

OBJS = $(LIBSOU:.cpp=.obj)

INCS = fastdb.h stdtp.h class.h database.h cursor.h referenc.h \
	array.h file.h hashtab.h ttree.h sync.h query.h datetime.h

LIBS = fastdb.lib 

EXAMPLESSRC = guess.cpp testdb.cpp testjoin.cpp testddl.cpp testperf.cpp \ 
	testsync.cpp testiref.cpp testtrav.cpp testidx.cpp subsql.cpp clitest.c \
	bugdb.cpp cgistub.cpp clidb.cpp

#EXAMPLES = $(EXAMPLESSRC:.cpp=.exe)

CC = BCC32.EXE

CFLAGS = -Ox -N -DNO_MEMBER_TEMPLATES

CLFLAGS = -c $(CFLAGS)

LD = $(CC)
LDFLAGS = 

AR = tlib
ARFLAGS = 

STDLIBS = 

LIBOBJLST=libobj.txt

all: $(LIBOBJLST) $(LIBS) EXAMPLES

$(LIBOBJLST): $(LIBSOU) 
	&$(CC) $(CLFLAGS) $**
	&echo $** >> $(LIBOBJLST)

$(LIBS): $(OBJS)
	del fastdb.lib
    del $(LIBOBJLST)
    &$(AR) $(ARFLAGS) fastdb.lib +$**
    del fastdb.bak

EXAMPLES: $(EXAMPLESSRC)
	&$(CC) $(CFLAGS) $** $(LIBS) $(STDLIBS)

cpp.obj:
	$(CC) $(CFLAGS) $**

cleanobj:
	del *.odb,*.obj,*.pch,*.pdb,*.ilk,*.dsp,*.dsw,*.ncb,*.opt

cleandbs:
	del *.fdb

clean: cleanobj cleandbs
	del *~,*.lib,*.exe


zip: clean
	cd ..
	del fastdb.zip
        zip -r fastdb.zip fastdb

copyzip: zip
	copy fastdb.zip a:

